//
//  SVProgressHUD+show.m
//  WisdomStar
//
//  Created by 谭飞 on 2018/11/13.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "SVProgressHUD+show.h"

@implementation SVProgressHUD (show)

+ (void)initialize {
    // 设置样式
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
    
    // 设置hud背景颜色和字体颜色
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    [SVProgressHUD setBackgroundColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.8]];
    
    // 设置圆角
    [SVProgressHUD setCornerRadius:5.f];
    
    // 设置图标
//    [SVProgressHUD setSuccessImage:ImageMake(@"success_hud")];
    
    // 设置原生动画效果
    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeNative];
    
    // 设置弹出动画
    [SVProgressHUD setFadeInAnimationDuration:0.25]; //放大出现
    [SVProgressHUD setFadeOutAnimationDuration:1];
    
    // offset
    [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, kMainScreenHeight/2-100.f)];
}

+ (void)showLoading:(NSString *)status {
    if (status) {
        [SVProgressHUD showWithStatus:status];
    } else {
        [SVProgressHUD show];
    }
}

+ (void)showMessage:(NSString *)message {
    [SVProgressHUD showWithStatus:message];
    [SVProgressHUD showImage:WSImageMake(@"") status:message];
    [SVProgressHUD dismissWithDelay:2.f];
}

+ (void)showSuccess:(NSString *)success {
    [SVProgressHUD showSuccessWithStatus:success];
    [SVProgressHUD dismissWithDelay:2.f];
}

+ (void)showError:(NSString *)error {
    [SVProgressHUD showErrorWithStatus:error];
    [SVProgressHUD dismissWithDelay:2.f];
}

@end
